package net.wanho.client;

import net.wanho.config.MyLoadBalancerConfig;
import net.wanho.entity.User;
import net.wanho.vo.AjaxResult;
import org.springframework.cloud.loadbalancer.annotation.LoadBalancerClients;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 * Author：汤小洋
 * Date：2024-02-21 16:56
 * Description：<描述>
 */
// @FeignClient("user-provider") // 指定要调用的服务名称
@FeignClient(value = "cloud-gateway", fallback = UserClientFallback.class)
@LoadBalancerClients(defaultConfiguration = MyLoadBalancerConfig.class)
public interface UserClient {

    @GetMapping("/users/test")
    public String test();

    @GetMapping("/users")
    public AjaxResult list(@RequestParam("username") String username);

    @DeleteMapping("/users/{id}")
    public AjaxResult removeById(@PathVariable("id") Integer id);

    @PostMapping("/users")
    public AjaxResult add(@RequestBody User user);

    @PutMapping("/users")
    public AjaxResult modify(@RequestBody User user);

    @GetMapping("/users/query")
    public AjaxResult query(@RequestParam Map<String,Object> map);

}
